package com.frank.config.es.config.entity;

import lombok.Data;
import lombok.experimental.Accessors;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.search.aggregations.AggregationBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;

import java.io.Serializable;
import java.util.List;

/**
 * @author Frank Zou
 * @version v0.0.1
 * @date 2024/6/25
 * @description Elasticsearch 搜索请求类
 */
@Data
@Accessors(chain = true)
public class EsSearchRequest implements Serializable {

    /**
     * 查询条件构造器
     */
    private BoolQueryBuilder queryBuilder;

    /**
     * 聚合构造器
     */
    private AggregationBuilder aggregationBuilder;

    /**
     * 排序构造器
     */
    private List<FieldSortBuilder> fieldSortBuilders;

    /**
     * 高亮构造器
     */
    private HighlightBuilder highlightBuilder;

    /**
     * 查询字段
     */
    private String[] fields;

    /**
     * 分页 from，从第多少条开始获取数据
     */
    private Integer from;

    /**
     * 每页条数， 获取多少条数据
     */
    private Integer size;

    /**
     * 是否需要快照缓存
     */
    private Boolean needScroll = false;

    /**
     * 快照缓存时间
     */
    private Long minute;




    /**
     * 是否开启随机排序 默认关闭
     */
    private Boolean isRandomScore = false;
}
